package Entity;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(schema="poleinfodb", name = "contract")
@Inheritance(strategy=InheritanceType.JOINED)
public class Contract {

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id_Contract;
	
	@Transient
	private Society society;
	
	@ManyToOne
	@JoinColumn(name="ID_OFFER")
	private Offer offer;
	
	@Transient
	private Investor investor = null;
	
	@Basic(optional=false)
	private String name;
	
	@Basic(optional=false)
	private double open;
	
	@Basic(optional=false)
	private double close;
	
	@Basic(optional=false)
	private double high;
	
	@Basic(optional=false)
	private double low;
	
	public Contract(int id_Contract, Society society, Offer offer,
			Investor investor, String name, double open, double close,
			double high, double low) {
		super();
		this.id_Contract = id_Contract;
		this.society = society;
		this.offer = offer;
		this.investor = investor;
		this.name = name;
		this.open = open;
		this.close = close;
		this.high = high;
		this.low = low;
	}
	public Contract( Society society, Offer offer,
			Investor investor, String name, double open, double close,
			double high, double low) {
		super();
		this.society = society;
		this.offer = offer;
		this.investor = investor;
		this.name = name;
		this.open = open;
		this.close = close;
		this.high = high;
		this.low = low;
	}

	@Override
	public String toString() {
		return "Contract [id_Contract=" + id_Contract + ", society=" + society
				+ ", offer=" + offer + ", investor=" + investor + ", name="
				+ name + ", open=" + open + ", close=" + close + ", high="
				+ high + ", low=" + low + "]";
	}

	public int getId_Contract() {
		return id_Contract;
	}

	public void setId_Contract(int id_Contract) {
		this.id_Contract = id_Contract;
	}

	public Society getSociety() {
		return society;
	}

	public void setSociety(Society society) {
		this.society = society;
	}

	public Offer getOffer() {
		return offer;
	}

	public void setOffer(Offer offer) {
		this.offer = offer;
	}

	public Investor getInvestor() {
		return investor;
	}

	public void setInvestor(Investor investor) {
		this.investor = investor;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getOpen() {
		return open;
	}

	public void setOpen(double open) {
		this.open = open;
	}

	public double getClose() {
		return close;
	}

	public void setClose(double close) {
		this.close = close;
	}

	public double getHigh() {
		return high;
	}

	public void setHigh(double high) {
		this.high = high;
	}

	public double getLow() {
		return low;
	}

	public void setLow(double low) {
		this.low = low;
	}	
}
